<template>
    <div class="login">
        <div class="login_bg">
            <div class="log_logo">
                <img src="https://stnz.oss-cn-hangzhou.aliyuncs.com/assets/images/logo.png">
            </div>
            <!-- 验证码登录 -->
            <div class="pd_log">

                <div class="pdlog_one">
                    <div class="pdl_top">
                        <div class="pdl_side">
                            <img src="https://stnz.oss-cn-hangzhou.aliyuncs.com/assets/images/name.png"> 手机号
                        </div>
                        <div class="pdl_cont">
                            <input
                                    type="number"
                                    v-model.number="ReginForm.tel"
                                    placeholder="请输入你的手机号"/>
                        </div>
                    </div>
                    <div class="pdl_top">
                        <div class="pdl_side">
                            <img src="https://stnz.oss-cn-hangzhou.aliyuncs.com/assets/images/yxz.png"> 登录密码
                        </div>
                        <div class="pdl_conts">
                            <input type="text" placeholder="请设置登录密码" v-model="verification" class="pdl_conts-input"/>
                        </div>
                    </div>
                    <div class="pdlog_two">
                        <button
                                type="success"
                                round
                                v-on:click="submit"
                                @click.native.prevent="submit"
                                :loading="logining"
                                :disabled="!verification" :class="verification ? 'yf_submitBtn' : 'submitBtn'">
                            确定
                        </button>
                        <p>* 新用户注册立即获得15.8元现金</p>
                    </div>
                </div>

            </div>
        </div>
    </div>
</template>

<script>
    import Rule from '../../common/validate.js';

    export default {
        name: "adminRegister",
        data() {
            return {
                ReginForm: {tel: '',},
                logining: false,
                sendAuthCode: true, /*布尔值，通过v-show控制显示‘获取按钮'还是‘倒计时' */
                auth_time: 0, /*倒计时 计数器*/
                verification: "",//绑定输入验证码框框
                rule: {
                    tel: [
                        {required: true, message: '请输入电话号码', trigger: 'blur'},
                        {validator: Rule.checkNull, trigger: 'blur'},
                        {validator: Rule.checkTszf, trigger: 'blur'},
                        {validator: Rule.checkCellPhone, trigger: 'blur'}
                    ],
                }
            }
        },
        methods: {
            // 提交数据
            submit() {

                this.logining = true
                this.thisAjax();

            },
            async userInfo(){

                let params = {
                    params: {
                        code: this.$base.getQueryString("code")
                        // isAll: 1
                    }
                };

                const res=await this.$axios.get(this.$api.toWxActivity, params);

                if(res.msg==="-1"){
                    localStorage.setItem('loginType',3);

                    let params2 = {
                        type : 1,
                        openId:res.data.openid,
                        nickname:res.data.nickname,
                        avatar:res.data.headimgurl
                    };
                    const result=await this.$axios.post("http://admin.sl.com/public/index.php/wechatLogin", params2);
                    console.log(result);

                }else{
                    this.$router.push({
                        path: "./adminLogin",
                    });
                }


            },

            reset() {
                this.$refs.ReginForm.resetFields()
            },
        },
        beforeCreate:function(){

        },
        created: function () {


        },
        mounted() {

            this.userInfo();

        }

    }


</script>

<style scoped>
    .login {
        width: 100%;
        background-image: url("https://stnz.oss-cn-hangzhou.aliyuncs.com/assets/images/login_bg.png");
        background-size: 100% 100%;
        height: 100%;
        min-height: 100vh;
    }

    .log_logo {
        width: 35%;
        margin: 0 auto;
    }

    .log_logo img {
        width: 100%;
        padding-top: 1rem;
    }

    .pdl_top {
        width: 90%;
        margin: 0 auto 0.1rem;
        background-color: rgba(192, 192, 192, 0.5);
        height: 0.4rem;
        overflow: hidden;
    }

    .pdl_side {
        width: 25%;
        padding-left: 0.1rem;
        border-right: 1px solid #efefef;
        float: left;
        color: white;
        font-size: 0.14rem;
        line-height: 0.3rem;
        margin-top: 0.05rem;
    }

    .pd_log {
        padding-top: 0.7rem;
        font-size: 0;
    }

    .pdl_side img {
        width: 0.2rem;
        position: relative;
        top: 0.05rem;
    }

    .pdl_cont input {
        height: 0.4rem;
        width: 100%;
        background-color: hsla(0, 0%, 47%, .1);;
        outline: none;
        border: 0;
        font-size: 0.14rem;
        position: relative;
        top: 0;
        left: 0.1rem;
        color: white;
    }

    .pdl_cont input::-webkit-input-placeholder {
        color: #FFF;
        font-size: 0.14rem;
    }

    .ic_name {
        width: 0.5rem;
        position: relative;
        top: 0.1rem;
    }

    .pdl_cont {
        width: 65%;
        float: left;
    }

    .pdl_conts {
        width: 73%;
        float: left
    }

    .pdl_conts-input {
        height: 0.4rem;
        width: 55%;
        background-color: hsla(0, 0%, 47%, .1);
        outline: none;
        border: 0;
        font-size: 0.14rem;
        margin-left: 0.1rem;
        color: white;
    }

    .pdl_conts-input::-webkit-input-placeholder {
        color: #FFF;
        font-size: 0.14rem;
    }

    .pdls_btn {
        background: #01bf47;
        border: 1px solid #01bf47;
        color: #fff;
        border-radius: 0.5rem;
        font-size: 0.12rem;
        padding: 0.05rem 0.1rem;
    }

    .pdlog_two {
        width: 90%;
        margin: 0 auto;
    }

    .yf_submitBtn {
        background: #01bf47;
        border: 1px solid #01bf47;
        color: #fff;
        font-size: 0.14rem;
        width: 100%;
        padding: 0.1rem 0;
        border-radius: 0.05rem;
        outline: none;
    }

    .submitBtn {
        background: rgba(216, 216, 216, 0.4);
        border: 0;
        color: #fff;
        font-size: 0.14rem;
        width: 100%;
        padding: 0.1rem 0;
        border-radius: 0.05rem;
        outline: none;
    }
</style>
